package com.dreamtour.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dreamtour.DTO.ApplicationDTO;
import com.dreamtour.mapper.ApplicationMapper;
import com.dreamtour.service.IApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, ApplicationDTO> implements IApplicationService {
    @Autowired
    private ApplicationMapper applicationMapper;

    @Override
    public List<ApplicationDTO> getApplications() {
        return applicationMapper.getApplicationList();
    }

    @Override
    public List<ApplicationDTO> filterApplications(String applyCategory){
        if ("定制官".equals(applyCategory)){
            return applicationMapper.getDesignerApplicationList();
        }
        return applicationMapper.getAgencyApplicationList();
    }

    @Override
    public List<ApplicationDTO> getByUserId(Integer userId) {
        return applicationMapper.selectById(userId);
    }

}
